import fetch from 'common/src/utils/fetch'
import UTILS from "common/src/utils/utils";


function getRounds(data) {
  return fetch({
    url: `/api/electionservice/student/getRounds`,
    method: 'post',
    params: data
  });
}
// 学生辅修选课
function getMinorRounds(data) {
  return fetch({
    url: '/api/electionservice/microStudent/getMinorRounds',
    method: 'post',
    params: data
  });
}
function minorLoading(roundId) {
  return fetch({
    url: `/api/electionservice/microStudent/${roundId}/minorStudentLoading`,
    method: 'post'
  });
}
function minorElectRes(roundId) {
  return fetch({
    url: `/api/electionservice/microStudent/${roundId}/electRes`,
    method: 'post'
  });
}
function getMinorDataBk(roundId) {
  return fetch({
    url: `/api/electionservice/microStudent/${roundId}/getMinorData`,
    method: 'post'
  });
}

function loading(roundId) {
  return fetch({
    url: `/api/electionservice/student/${roundId}/loading`,
    method: 'post'
  });
}
function getData(roundId) {
  return fetch({
    url: `/api/electionservice/student/${roundId}/getData`,
    method: 'post'
  });
}
function getDataBk(roundId) {
  return fetch({
    url: `/api/electionservice/student/${roundId}/getDataBk`,
    method: 'post'
  });
}
function getTeachClass(data) {
  return fetch({
    url: `/api/electionservice/student/getTeachClass`,
    method: 'post',
    params: data
  });
}
function getTeachClass4Limit(data) {
  return fetch({
    url: `/api/electionservice/student/getTeachClass4Limit`,
    method: 'post',
    params: data
  });
}
function getMiniorTeachClass4Limit(data) {
  return fetch({
    url: `/api/electionservice/student/getMiniorTeachClass4Limit`,
    method: 'post',
    params: data
  });
}
function elect(data) {
  return fetch({
    url: `/api/electionservice/student/elect`,
    method: 'post',
    data: data
  });
}
function minorElect(data) {
  return fetch({
    url: `/api/electionservice/microStudent/elect`,
    method: 'post',
    data: data
  });
}
function electRes(roundId) {
  return fetch({
    url: `/api/electionservice/student/${roundId}/electRes`,
    method: 'post'
  });
}

function findDept() {
  return fetch({
    url: `/api/electionservice/elcMutualCourses/findDept?manageDept=0&type=1&virtualDept=0`,
    method: 'get'
  });
}

/**
 * 研究生获取轮次
 */
function getRoundsYjs(data) {
  return fetch({
    url: `/api/electionservice/student/getGraduateRounds`,
    method: 'post',
    params: data
  });
}

/**
 *研究生可选课程
 */
function findUnselectedCourseList(data) {
  return fetch({
    url: '/api/electionservice/student/getOptionalCourses?roundId=' + data.roundId,
    method: 'get',
    data: data
  });
}
/**
 * 培养计划
 */
function getElectionCulturePlan(data) {
  return fetch({
    url: '/api/electionservice/student/culturePlanMsg?roundId=' + data.roundId,
    method: 'post',
    data: data
  });
}
/**
 * 培养计划完成情况
 */
function getElectionCulturePlanCompletion(data) {
  return fetch({
    url: `/api/electionservice/student/culturePlanData`,
    method: 'post',
    data: data
  });
}

/**
 * 本研互选
 */
function getRoundsMutual(data) {
  return fetch({
    url: `/api/electionservice/mutualStudent/getRounds`,
    method: 'post',
    params: data
  });
}
function loadingMutual(roundId) {
  return fetch({
    url: `/api/electionservice/mutualStudent/${roundId}/loading`,
    method: 'post'
  });
}
function getDataMutual(roundId) {
  return fetch({
    url: `/api/electionservice/mutualStudent/${roundId}/getData`,
    method: 'post'
  });
}
function mutualElect(data) {//本研互选选课
  return fetch({
    url: `/api/electionservice/mutualStudent/elect`,
    method: 'post',
    data: data
  });
}
function electMutualRes(roundId) {//本研互选选课结果
  return fetch({
    url: `/api/electionservice/mutualStudent/${roundId}/electRes`,
    method: 'post'
  });
}
function getMutualTeachClass(data) {//获取本研互选教学班
  return fetch({
    url: `/api/electionservice/mutualStudent/getTeachClass`,
    method: 'post',
    params: data
  });
}
function loginCheck(data) {//本研互选选课结果
  return fetch({
    url: `/api/electionservice/student/loginCheck`,
    method: 'post',
    data: data
  });
}

/**
 *
 * @param {*} roundId
 * @param {*} courseCode
 * @param {*} teachClassId
 */
function getConflict(roundId, teachClassId, studentId) {
  return fetch({
    url: '/api/electionservice/student/getConflict?roundId=' + roundId + '&teachClassId=' + teachClassId + '&studentId=' + studentId,
    method: 'get'
  });
}

function hasHonorPlan(calendarId, studentId) {
  return fetch({
    url: '/api/electionservice/honorPlanStds/hasHonorPlan?calendarId=' + calendarId + '&studentId=' + studentId,
    method: 'get'
  });
}

function getPublicCourse(data) {//本研互选选课结果
  return fetch({
    url: `/api/electionservice/student/getPublicCourse`,
    method: 'post',
    data: data
  });
}
export default {
  "getRounds": getRounds, //查询可用轮次
  "loading": loading, // 初始化数据
  "getData": getData, // 初始化数据
  "getDataBk": getDataBk, // 初始化数据本科
  "getTeachClass": getTeachClass, // 查询课程对应的教学班
  "elect": elect, // 选课
  mutualElect,//本研互选选课
  electMutualRes,//本研互选选课结果
  getMutualTeachClass,//本研互选教学班
  "electRes": electRes, // 选课结果
  "getRoundsYjs": getRoundsYjs, //研究生查询可用轮次
  "findUnselectedCourseList": findUnselectedCourseList, // 研究生可选课程
  "getElectionCulturePlan": getElectionCulturePlan, // 研究生选课培养计划,
  findElectionArrangementCoursesUrl: '/api/electionservice/student/round/arrangementCourses', // 研究生全部课程,
  "getElectionCulturePlanCompletion": getElectionCulturePlanCompletion, // 研究生选课培养计划完成情况,
  "getRoundsMutual": getRoundsMutual,  //本研互选--可用轮次
  "loadingMutual": loadingMutual,  //本研互选--初始化数据
  "getDataMutual": getDataMutual,  //本研互选--初始化数据本科
  "publicCourseUrl": "/api/cultureservice/coursesCategoryRel/courses/list",
   'minorElect':minorElect,//辅修选课
   'minorElectRes':minorElectRes,
  loginCheck: loginCheck,
  getConflict: getConflict,
  getTeachClass4Limit: getTeachClass4Limit,
  getMiniorTeachClass4Limit :getMiniorTeachClass4Limit,
  hasHonorPlan: hasHonorPlan,
  getPublicCourse: getPublicCourse,
  findEnquiryOfCoursesUrl: '/api/electionservice/student/round/allArrangementCourses',
  findDept: findDept,
  getMinorRounds,
  minorLoading,
  getMinorDataBk
}
